package org.trackcore.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.trackcore.common.BaseResponse;
import org.trackcore.common.ResultUtils;
import org.trackcore.model.entity.BehaviorHashRoute;
import org.trackcore.service.BehaviorHashRouteService;

import javax.annotation.Resource;

@RestController
@RequestMapping("/behavior/route")
@Api(tags = "行为路由接口")
public class BehaviorHashRouteController {
    @Resource
    private BehaviorHashRouteService hashRouteService;

    @GetMapping("/list")
    @ApiOperation("分页查询所有行为路由")
    public BaseResponse<IPage<BehaviorHashRoute>> analyzeRoutes(
            @RequestParam(defaultValue = "1") Integer pageNum,
            @RequestParam(defaultValue = "10") Integer pageSize) {
        return ResultUtils.success(hashRouteService.page(new Page<>(pageNum, pageSize)));
    }
}
